package services;

public class ServiceCheckCredit {
    
    
    public String checkCredit(Integer id){
        ServiceCart serviceCart = new ServiceCart();
        ServiceUser serviceUser = new ServiceUser();
        double total =0;
        total = Double.parseDouble(serviceCart.totalCartPrice(id));
        double credit=0;
        credit = Double.parseDouble(serviceUser.getUserData(id).getCredit());
        if(credit<total){
            return "out of credit";
        }else{
            return "buy";
        }
    }
   
    
//    public static void main(String[] args) {
//        System.out.println(new ServiceCheckCredit().checkCredit(4));
////
////         System.out.println(new ServiceCart().totalCartPrice(4));
////         System.out.println(new ServiceCart().countProductsInCart(4));
////
//    }
    
}

